home *** CD-ROM | disk | FTP | other *** search
- #include "SetUpA4.h"
- Pattern grey={ 170,85,170,85,170,85,170,85 },
- wite={ 0,0,0,0,0,0,0,0 },
- dark={ 119,238,221,187,119,238,221,187 };
-
- pascal void main(message,select,r,theCell,offset,len,LH)
- int message,offset,len;
- ListHandle LH;
- Cell theCell;
- Boolean select;
- Rect *r;
- {
- int l;
-
- RememberA0();
- SetUpA4();
- switch(message){
- case 0: break;
- case 1:
- case 2: doDraw(select,r,offset,LH); break;
- case 3: break;
- }
- RestoreA4();
- }
-
- doDraw(select,r,offset,LH)
- Boolean select;
- Rect *r;
- int offset;
- ListHandle LH;
- {
- BitMap icon;
- Rect src,r1;
- char p[32],*q,*s,c;
- register int len,i;
- FontInfo inf;
-
- FillRect(r,grey);
- r->top+=(r->bottom-r->top-32)/2;
- r->left+=(r->right-r->left-32)/2;
- r->bottom=r->top+32;
- r->right=r->left+32;
- InsetRect(r,-4,-4);
- r1=*r;
- FillRect(r,wite);
- FrameRect(r);
- InsetRect(r,3,3);
- FrameRect(r);
- InsetRect(r,1,1);
- PenPat(dark);
- for(i=1;i<3;i++){
- MoveTo(r->left-(i+1),r->bottom+i);
- LineTo(r->right+i,r->bottom+i);
- MoveTo(r->right+i,r->top-(i+1));
- LineTo(r->right+i,r->bottom+i);
- }
- PenNormal();
-
- HLock((**LH).cells);
- icon.baseAddr=(char *)(*(**LH).cells)+offset;
- SetRect(&icon.bounds,0,0,32,32);
- icon.rowBytes=4;
- src=icon.bounds;
- CopyBits(&icon,&((**LH).port->portBits),&src,r,0,0L);
- offset+=128;
-
- q=(char *)(*(**LH).cells)+offset;
- s=p;
- len=*s++=*q++;
- while(--len>=0)*s++=*q++;
- HUnlock((**LH).cells);
-
- if(*p>5){
- p[5]=0xC9;
- *p=5;
- }
- c=(r->left+16)-(StringWidth(p)/2);
- GetFontInfo(&inf);
- i=r->bottom+inf.ascent+inf.descent+inf.leading;
- SetRect(&r1,c,r->bottom+4,c+StringWidth(p),i);
- EraseRect(&r1);
- MoveTo(c,i);
- DrawString(p);
- if(select){
- HiliteMode&=127;
- InvertRect(r);
- }
- }
-
-